/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "DOCUMENTOS", catalog = "", schema = "PROYECTO")
@NamedQueries({
    @NamedQuery(name = "Documentos.findAll", query = "SELECT d FROM Documentos d"),
    @NamedQuery(name = "Documentos.findByRegistroCodigo", query = "SELECT d FROM Documentos d WHERE d.registroCodigo = :registroCodigo"),
    @NamedQuery(name = "Documentos.findByCarnet", query = "SELECT d FROM Documentos d WHERE d.carnet = :carnet"),
    @NamedQuery(name = "Documentos.findByRecibopago", query = "SELECT d FROM Documentos d WHERE d.recibopago = :recibopago")})
public class Documentos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "REGISTRO_CODIGO", nullable = false)
    private Integer registroCodigo;
    @Column(name = "CARNET", length = 350)
    private String carnet;
    @Column(name = "RECIBOPAGO", length = 350)
    private String recibopago;
    @JoinColumn(name = "REGISTRO_CODIGO", referencedColumnName = "CODIGO", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Registro registro;

    public Documentos() {
    }

    public Documentos(Integer registroCodigo) {
        this.registroCodigo = registroCodigo;
    }

    public Integer getRegistroCodigo() {
        return registroCodigo;
    }

    public void setRegistroCodigo(Integer registroCodigo) {
        this.registroCodigo = registroCodigo;
    }

    public String getCarnet() {
        return carnet;
    }

    public void setCarnet(String carnet) {
        this.carnet = carnet;
    }

    public String getRecibopago() {
        return recibopago;
    }

    public void setRecibopago(String recibopago) {
        this.recibopago = recibopago;
    }

    public Registro getRegistro() {
        return registro;
    }

    public void setRegistro(Registro registro) {
        this.registro = registro;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (registroCodigo != null ? registroCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Documentos)) {
            return false;
        }
        Documentos other = (Documentos) object;
        if ((this.registroCodigo == null && other.registroCodigo != null) || (this.registroCodigo != null && !this.registroCodigo.equals(other.registroCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Documentos[registroCodigo=" + registroCodigo + "]";
    }

}
